package com.exam.commonbiz.adapter;

import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.exam.commonbiz.R;
import com.exam.commonbiz.bean.BottomSheetDialogInfo;
import com.exam.commonbiz.util.OnFastClickListener;

public class BottomSheetDialogAdapter extends BaseQuickAdapter<BottomSheetDialogInfo, BaseViewHolder> {

    private OnItemClickListener listener;

    public void setOnItemClickListener(OnItemClickListener onItemClickListener) {
        listener = onItemClickListener;
    }

    public BottomSheetDialogAdapter() {
        super(R.layout.item_layout_bottom_sheet_dialog, null);
    }

    @Override
    protected void convert(BaseViewHolder helper, BottomSheetDialogInfo item) {

        helper.setText(R.id.tv_content, item.content);

        helper.itemView.setOnClickListener(new OnFastClickListener() {
            @Override
            public void onFastClick(View v) {
                if (listener != null) {
                    listener.onItemClick(item);
                }
            }
        });
    }

    public interface OnItemClickListener {
        void onItemClick(BottomSheetDialogInfo messageInfo);
    }
}
